02. Build Your Project

Build Your Project

Build Your Project

For this project, you will only need to submit a single Java class. No other files are necessary. The class file is intended to represent a report card.

Your Java class should keep track of various grades. You can use character variables (e.g. char englishGrade = 'A';), String variables (e.g. String mathGrade = "A-";), integer variables (e.g. int historyGrade = 85;), or double variables (e.g. double biologyGrade = 90.5;) to keep track of grades.

The design is up to you. Your class needs to be able to keep track of grades, access them, and set them. It is recommended that you use getters and setters, which are methods which return and set specific variables. For example, if your class had an int variable called chemistryGrade, you might include methods such as

public int getChemistryGrade() {
    return chemistryGrade;
}

public void setChemistryGrade(int grade) {
    chemistryGrade = grade;
}

Methods like this allow another programmer to use your class without necessarily understanding all the variables inside. You will also need to implement a constructor. If your class is called ReportCard, your constructor would be structured like this:

public ReportCard() {
    //Initialize any variables here!
}

The most important portion of your project will be the toString() method, which gives a human-readable String representing the data stored in the report card. The signature looks like this:

@Override
public String toString() {
    //Your code here!  Return a representation of 
    //the report card rather than the empty string
    return "";
}

An example return value might be a String like "Name: John Doe; English grade: A; History grade: B-; Math grade: B+;" and so on.

Implementing the toString() Method

It may be useful for you to check out 15. The toString() concept in 6. Activity Lifecycle and Audio Playback lesson, which is located later in this Part before starting your project.

You can find this concept by clicking on the Search icon in the left-hand panel, and entering "tostring" in the input box.

Your project will be evaluated using the Report Card project rubric.